`ifndef MY_READY_DTV_SV
`define MY_READY_DTV_SV

class my_ready_drv extends uvm_component;
	virtual my_interface vif;
	
	`uvm_component_utils(my_ready_drv)
	
	extern function new(string name = "my_ready_drv", uvm_component parent=null);
	extern virtual function void build_phase(uvm_phase phase);
	extern virtual task main_phase(uvm_phase phase);
endclass: my_ready_drv

function my_ready_drv::new(string name = "my_ready_drv", uvm_component parent=null);
	super.new(name, parent);
endfunction: new

function void my_ready_drv::build_phase(uvm_phase phase);
	super.build_phase(phase);
	`uvm_info("my_ready_drv", "build_phase is called", UVM_LOW);
	if(!uvm_config_db #(virtual my_interface)::get(this, "", "vif", vif))begin
		`uvm_fatal("my_ready_drv", "virtual interface get fatal");
	end
endfunction: build_phase

task my_ready_drv::main_phase(uvm_phase phase);
	fork 
		while(1)begin
            @this.vif.ready_drv;
            //if(this.vif.ready_drv.valid == 1'b1) this.vif.ready_drv.ready <= 1'b1;
            //else this.vif.ready_drv.ready <= 1'b0;
            this.vif.ready = this.vif.valid;
        end
	join_none
endtask: main_phase

`endif
